/*
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-09-10 14:22:10
 * @LastEditTime: 2019-10-13 10:32:08
 * @LastEditors: Please set LastEditors
 */
import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex)
const store=new Vuex.Store({
    state:{
        token:'',
        Loading:false
    },
    mutations:{
        showLoading(state){
            state.LOADING=true
        },
        hideLoading(state){
            state.LOADING=false
        },
      setTokenn(state,data){
         state.token=data;
         localStorage.setItem('tokenn',JSON.stringify(data))
      },
      //清除vuex保存到的数据
      mapClearState(state){
        for(let item in state){
            state[item] = ''
        }
      },
    },
    plugins: [createPersistedState()]
})




export default store